package com.dg.cuckoo.admin.action.earlyProject.PPPProject;

import com.dg.cuckoo.admin.dto.earlyProject.EarlyProjectDto;
import com.dg.cuckoo.admin.service.CarryPlanService;
import com.dg.cuckoo.common.utils.PageModel;
import com.dg.cuckoo.core.BaseController;
import com.dg.cuckoo.core.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * 项目前期-PPP项目-实施方案
 */
@RestController
@RequestMapping("/earlyProject/PPPProject/carryPlan")
public class CarryPlan extends BaseController {

    @Autowired
    private CarryPlanService service;

    /**
     * 新增
     */
    @PostMapping("save")
    public JsonResult<Void> save(String projectId, EarlyProjectDto dto, MultipartFile[] files) throws Exception {
        service.save(projectId,dto,files);
        return new JsonResult<>(OK);
    }

    /**
     * 删除 用developmentBook的删除接口
     */

    /**
     * 分页
     * @param page 页
     * @param pageSize 页数
     * @param projectId 项目id
     * @return
     */
    @PostMapping("page/{page}/{pageSize}/{projectId}")
    public JsonResult<PageModel> page(@PathVariable Integer page, @PathVariable Integer pageSize, @PathVariable String projectId){
        PageModel data = service.page(page, pageSize,projectId);
        return new JsonResult<>(OK,data);
    }

    /**
     * 编辑
     */
    @PostMapping("update")
    public JsonResult<Void> update(String id,String projectId,MultipartFile[] files,EarlyProjectDto dto) throws Exception {
        service.update(id,projectId,files,dto);
        return new JsonResult<>(OK);
    }

    /**
     * 点击出现内容 用developmentBook的接口
     */

    /**
     * 点击出现信息 用developmentBook的接口
     */

}
